<?php 
	// view advertisement detail.
	$user = Advertisement::getUser($this->advertisement->id);
	$city = Advertisement::getCity($this->advertisement->id);
?>

<div class="titleSection">
	<?php if($this->advertisement->status == "closed"){?>
		<div class="closedMark"></div>
	<?php }?>
<div class="itemType">
<div class="
<?php if($this->advertisement->type == "lease") echo "itemLease"; else echo "itemWant";?>
"></div></div>
<?php if ($this->advertisement->category_id == Category::SHOP) {?>
<div class="itemTypeExtra"><div class="itemBusiness"></div></div>
<?php }?>
<div class="itemContent">
<h3 class="title"><?php echo $this->advertisement->title; ?></h3>
<div class="detail"><?php $postUserName = $user->name; echo '<a id="nameLink" href="#sendEmail">'; 
echo isset($postUserName) ? $postUserName : '未命名';
echo '</a>';
echo ' 发表于  '.$this->advertisement->created;
echo '   <a id="editLink" href="'.$this->url(array('id'=>$this->advertisement->id, 'city'=>$city->name), 'admin').'">修改, 删除，关闭</a> 您的帖子';
?></div>
</div>

</div>
<div class="dashline"></div>
<div class="contentSection">
<div class="contentDetail">
<div class="detailItem">
	<div class="itemVar">时间</div>
	<div class="itemValue"><?php echo $this->advertisement->start_date; 
	
	if(!$this->dateIsLongTerm($this->advertisement->stop_date))
		echo "到".$this->advertisement->stop_date;
	else
		echo "起长期";
	?>
	</div>
</div>
<?php if($this->advertisement->rent != null ) {?>
<div class="detailItem">
	<div class="itemVar"><?php if($this->advertisement->type == "want") echo "最高";?>房租</div>
	<div class="itemValue"><?php echo $this->advertisement->rent.' '.$this->RentFormat($this->advertisement); ?></div>
</div>
<?php } ?>
<?php if($this->advertisement->area != null ) {?>
<div class="detailItem">
	<div class="itemVar"><?php if($this->advertisement->type == "want") echo "最小";?>面积 </div>
	<div class="itemValue"><?php echo $this->advertisement->area; ?> 平方米</div>
</div>
<?php } ?>
<?php if($this->advertisement->num_of_room != null && $this->advertisement->area > 0) {?>
<div class="detailItem">
	<div class="itemVar"><?php if($this->advertisement->type == "want") echo "最少";?>房间数</div>
	<div class="itemValue"><?php echo $this->advertisement->num_of_room; ?> </div>
</div>
<?php } ?>
<?php if($this->advertisement->address != null ) {?>
<div class="detailItem addressItem">
	<div class="itemVar">地址 </div>
	<div class="itemValue"><?php echo $this->advertisement->address; ?></div>
</div>
<?php } ?>
</div>

<div class="contentDescription">

<?php echo nl2br($this->advertisement->description);?>

</div>

</div>

<div class="dashline"></div>
<?php if($this->advertisement->status == "closed"){?>
<div class="contentSection" style="display:block;">
<div class="actionItem" style="text-indent:0;">此贴已关闭</div>
</div>
<?php }?>
<?php if($this->advertisement->status == "active"){?>
<div class="contentSection" style="display:block;">
<a name="sendEmail"></a>
<div class="actionItem email"><a id="sendEmailLink" href="#sendEmail">给他发邮件</a></div>

<?php if ($user->mobile != null) { ?>
<div class="actionItem mobile"><?php echo $user->mobile;?></div>
<?php } ?>

<div class="actionItem edit"><a href="<?php echo $this->url(array('id'=>$this->advertisement->id, 'city'=>$city->name), 'admin');?>">
修改, 删除，关闭</a> 您的帖子</div>
<!--
<div style="float:left;margin-top:5px;">
<a name="fb_share" type="button_count" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script></div>

<div style="float:left;margin:5px 0 0 15px;">
<a title="发布到 Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="small-count" data-locale="sv"></a>
<script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script>
</div>
  -->

<!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_fb"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_buzz"></a>
	<a class="jiathis_button_msn"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_douban"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/?uid=1525577" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
</div>
<script type="text/javascript">var jiathis_config = {data_track_clickback:true};</script>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js?uid=1525577" charset="utf-8"></script>
<!-- JiaThis Button END -->

</div>
<div id="sendEmailSection">

<div class="dotline"></div> <span></span>
<div id="closeSendEmail"></div>
<?php 
	// send interest mail.
	echo $this->form;
?>
</div>
<?php }?>
